<!DOCTYPE html>
            
<HTML>
<HEAD>
<meta name="booktitle" content="Developing Applications With Objective Caml" >
 <meta charset="ISO-8859-1"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<META name="GENERATOR" content="hevea 1.05-7 of 2000-02-24">
<META NAME="Author" CONTENT="Christian.Queinnec@lip6.fr">
<LINK rel=stylesheet type="text/css" href="videoc-ocda.css">
<script language="JavaScript" src="videoc.js"><!--
//--></script>
<TITLE>
 Preloaded Library
</TITLE>
</HEAD>
<BODY class="regularBody">
<A HREF="book-ora074.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="book-ora076.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2> Preloaded Library</H2>
<A NAME="sec-pervasives"></A>
<A NAME="@concepts149"></A>
<A NAME="@fonctions201"></A>
The <TT>Pervasives</TT> library is always preloaded so that it will be available
at the toplevel (interactive) loop or for inline compilation. It is always linked
and is the initial environment of the language. It contains the
declarations of:
<UL>
<LI>
 <B>type</B>: basic types (<I>int</I>, <I>char</I>,
<I>string</I>, <I>float</I>, <I>bool</I>, <I>unit</I>,
<I>exn</I>, <I>'a array</I>, <I>'a list</I>) and the types
<I>'a option</I> (see page <A HREF="book-ora076.html#subsec-printf">??</A>) and <I>('a,
'b, 'c) format</I> (see page <A HREF="book-ora089.html#sec-weak">??</A>).<BR>
<BR>

<LI> <B>exceptions</B>: A number of exceptions are raisable by the execution
library. Some of the more common ones are the following:
<UL>
<LI> 
 Failure<CODE> </CODE><B>of</B><CODE> </CODE>string that is raised by the function
<TT>failwith</TT> applied to a string.

<LI> Invalid_argument<CODE> </CODE><B>of</B><CODE> </CODE>string that indicates that an argument
cannot be handled by the function having raised the exception.
The function <TT>invalid_arg</TT>
applied to a string starts this exception.

<LI> Sys_error<CODE> </CODE><B>of</B><CODE> </CODE>string, for the input/output, typically
in attempting to open a nonexistent file for reading. 

<LI> End_of_file for detecting the end of a file.

<LI> Division_by_zero for zero divide errors between integers.
</UL>
As well as internal exceptions like:
<UL>
<LI>
 Out_of_memory and Stack_overflow for going
beyond the memory of the heap or the stack. It should be noted that
a program cannot recover from the <TT>Out_of_memory</TT> exception.
In effect, when it is raised it is too late to allocate new memory space
to continue functioning.<BR>Handling the <TT>Stack_Overflow</TT> exception
differs depending on whether the program was compiled in byte code or native
code. In the latter case, it is not possible to recover.
</UL><BR>

<LI> <B>functions</B>: there are roughly 140, half of which correspond to the C
functions of the execution library. There you may find mathematical and
comparison operators, functions on integer and floating-point numbers,
functions on character strings, on references and input-output. It should
be noted that a certain number of these declarations are in fact synonyms
for declarations defined in other modules. They are nevertheless declared
here for historical and implementation reasons.
</UL><HR>
<A HREF="book-ora074.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="book-ora076.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
